HADOOP-18801. Delete path directly when it can not be parsed in trash.#5744
HADOOP-18801. Delete path directly when it can not be parsed in trash.#5744Hexiaoqiao merged 8 commits intoapache:trunkfrom
Conversation
befcfea to
aec9e59
Compare
aec9e59 to
078150c
Compare
|
@Hexiaoqiao @ayushtkn Hi, Sir, could you please help me to review this PR if you have bandwidth? Thanks a lot. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
fix checkstyle warning. |
|
🎊 +1 overall
This message was automatically generated. |
|
@hfutatzhanghb Thanks to involve me here. I am not sure if you could solve the issue as HDFS-17046 mentioned. I think we should choose one of the following ways, |
@Hexiaoqiao , Sir, thanks a lot for your suggestions. Agree with the second approach and I will fix it soonly. Thanks again. |
|
💔 -1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
87479ab to
54c9366
Compare
|
🎊 +1 overall
This message was automatically generated. |
Hexiaoqiao
left a comment
There was a problem hiding this comment.
Thanks @hfutatzhanghb for your works. leave some comments inline. JFYI. Please let me know if something I missed.
| LOG.warn("Unexpected item in trash: "+dir+". Ignoring."); | ||
| continue; | ||
| if (cleanNonCheckpointUnderTrashRoot) { | ||
| this.moveToTrash(path, true); |
There was a problem hiding this comment.
Why move to trash again since it has been already under Trash home AND has configed to clean? IMO, it is safe to delete them directly.
| */ | ||
| public abstract boolean moveToTrash(Path path) throws IOException; | ||
| */ | ||
| public abstract boolean moveToTrash(Path path, boolean force) throws IOException; |
There was a problem hiding this comment.
Sorry I don't get meaning of the new parameter boolean force.
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testTrashEmptierWithNonCheckpointDir() throws Exception { |
There was a problem hiding this comment.
This new unit test seems not cover the case you try to fix, right? It could pass with/without this improvement.
There was a problem hiding this comment.
For this unit test, IMO, we should enable this config and then mkdir one path under Trash home directly, then wait to clean by Emptier. JFYI.
|
🎊 +1 overall
This message was automatically generated. |
|
@Hexiaoqiao Sir, could you please take a look at this PR when you have free time? Thanks a lot. |
|
💔 -1 overall
This message was automatically generated. |
Hexiaoqiao
left a comment
There was a problem hiding this comment.
Leave some comments inline. FYI.
| continue; | ||
| if (cleanNonCheckpointUnderTrashRoot) { | ||
| fs.delete(path, true); | ||
| LOG.warn("Unexpected item in trash: " + dir + ". Force moving to trash."); |
There was a problem hiding this comment.
Force moving to trash. -> Force to delete it.
| conf.setClass("fs.file.impl", TestLFS.class, FileSystem.class); | ||
| FileSystem fs = FileSystem.getLocal(conf); | ||
| conf.set("fs.defaultFS", fs.getUri().toString()); | ||
| conf.setBoolean(FS_TRASH_CLEAN_TRASHROOT_ENABLE_KEY, true); |
There was a problem hiding this comment.
I do not think we need to update this configuration item here. (L582,L639,L649, etc)
| * @throws Exception | ||
| */ | ||
| @Test | ||
| public void testTrashEmptierWithNonCheckpointDir() throws Exception { |
There was a problem hiding this comment.
For this unit test, IMO, we should enable this config and then mkdir one path under Trash home directly, then wait to clean by Emptier. JFYI.
| } | ||
| assertTrue(val == 0); | ||
| } | ||
| Thread.sleep(18000); |
There was a problem hiding this comment.
Please try to use GenericTestUtils.waitFor rather than Thread.sleep.
e6a59b1 to
1bf64b2
Compare
1bf64b2 to
dcf58a7
Compare
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
Hexiaoqiao
left a comment
There was a problem hiding this comment.
LGTM. +1. Let's wait if @ayushtkn will give furthermore comments before checkin.
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestTrash.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/TrashPolicyDefault.java
Outdated
Show resolved
Hide resolved
hadoop-common-project/hadoop-common/src/main/resources/core-default.xml
Outdated
Show resolved
Hide resolved
|
🎊 +1 overall
This message was automatically generated. |
ayushtkn
left a comment
There was a problem hiding this comment.
LGTM.
Thanx @Hexiaoqiao for holding, nothing more from my side, can be pushed :-)
|
Committed to trunk. Thanks @hfutatzhanghb for your contribution and @ayushtkn for your reviews! |
|
@Hexiaoqiao @ayushtkn Thanks sir for reviewing and merging. |
apache#5744). Contributed by farmmamba. Signed-off-by: Ayush Saxena <ayushsaxena@apache.org> Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
Description of PR
Please see HADOOP-18801.
How was this patch tested?
Add an UT.